class RoomInfo {
  int? id;
  String? roomNum;
  String? contact;
  String? address;
  String? phone;
  double? rent;
  double? otherCharge;
  double? electricityCharge;
  double? waterCharge;
  ///state:0-禁用 1-启用
  ///默认状态为正常
  int state = 1;

  RoomInfo(this.id, this.roomNum, this.contact,this.address, this.phone, this.rent,
      this.otherCharge, this.electricityCharge, this.waterCharge, this.state);

  RoomInfo.empty();

  Map<String, dynamic> toMap() {
    return {
      //插入和更新操作,均不需要操作id,而应该把id作为参数,故不需要放到toMap中
      // 'id': id,
      'roomNum': roomNum,
      'contact': contact,
      'phone': phone,
      'rent': rent,
      'otherCharge': otherCharge,
      'electricityCharge': electricityCharge,
      'waterCharge': waterCharge,
      'state': state,
    };
  }

  factory RoomInfo.fromMap(Map<String, dynamic> map) {
    return RoomInfo(
      map['id'],
      map['roomNum'],
      map['contact'],
      map['address'],
      map['phone'],
      map['rent'],
      map['otherCharge'],
      map['electricityCharge'],
      map['waterCharge'],
      map['state'],
    );
  }

  @override
  String toString() {
    return 'RoomInfo{id: $id, roomNum: $roomNum, contact: $contact, address: $address, phone: $phone, rent: $rent, otherCharge: $otherCharge, electricityCharge: $electricityCharge, waterCharge: $waterCharge, state: $state}';
  }
}
